

#pragma once
#include "Wrappers\CSGD_Direct3D.h"
#include "Wrappers\CSGD_DirectInput.h"
#include "Wrappers\CSGD_FModManager.h"
#include "Wrappers\CSGD_TextureManager.h"
#include <vector>

class IGameState;

class CGame
{
private:
	//Singletons
	CSGD_Direct3D*			m_pD3D;
	CSGD_TextureManager*	m_pTM;
	CSGD_DirectInput*		m_pDI;
	CSGD_FModManager*		m_pFM;

	//Assets
	int m_nImageID;
	int m_nSoundID;

	IGameState* m_pCurrentState;
	vector<IGameState*> m_pStates;

	int m_nScnHeight;
	int m_nScnWidth;

	int	m_nFrameCount;	//	the current frame count.
	int	m_nFPS;			//	frame count from previous
	

	//TimeBased Update
	DWORD m_dwTimeStamp;
	DWORD m_dwPrevTimeStamp;
	float m_fElapsedTime;
	float m_fGameTime;
	
	bool m_bWin;
	bool m_bIsFullScreen;
	bool m_bIsPaused;

	float fVolume, fSFX, fPan;

	CGame();

	//Trilogy of Evil
	CGame(const CGame&);
	CGame& operator=(const CGame&);
	~CGame();

	//Util
	bool Input();
	void Update();
	void Render();

public:
	//singleton access
	static CGame* GetInstance()
	{
		static CGame instance;
		return &instance;
	}
	
	void ChangeState(IGameState* pNewState);

	bool Main();
	void Initialize(HWND hWnd, HINSTANCE hInstance, int nScWidth, int nScHeight, bool bIsWindowed, bool bVsync);
	void ShutDown();


	// Accessors
	int GetScnHeight() const { return m_nScnHeight; }
	int GetScnWidth() const { return m_nScnWidth; }
	bool GetPause() { return m_bIsPaused; }
	float GetVolume() const { return fVolume; }
	float GetElapsedTime() const { return m_fElapsedTime; }

	float GetPan() const {return fPan;}
	float GetSFX() const { return fSFX; }
	bool GetWin() const { return m_bWin; }


	void SetWin( bool bWin ) { m_bWin = bWin; }
	void SetSFX(float val) { fSFX = val; }
	void SetVolume(float val) { fVolume = val; }
	void SetPan(float pan) {fPan = pan;};
	void SetPause( bool _bIsPaused ) { m_bIsPaused = _bIsPaused; }
};